<?php
declare (strict_types = 1);

namespace app\model;

use app\traits\CreationLimitTrait;
use think\Model;
use think\model\relation\BelongsTo;

/**
 * @mixin Model
 */
class OrganizationMembers extends Model
{
    use CreationLimitTrait;
    // 设置主键
    protected $pk = 'id';
    
    /**
     * 关联团队
     */
    public function organization(): BelongsTo
    {
        return $this->belongsTo(Organization::class, 'oid', 'id');
    }
    
    /**
     * 关联用户
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }
    
    /**
     * 关联角色
     */
    public function role(): BelongsTo
    {
        return $this->belongsTo(OrganizationRoles::class, 'role_id', 'id');
    }
}
